
import React, {Suspense} from 'react'
import { Spin } from 'antd'
import {BrowserRouter, Switch} from 'react-router-dom'
import { routes } from './routes'
import AuthRoute from './components/AuthRoute'

const Router = () => {
    return (
        <BrowserRouter>
            <Suspense fallback={<Spin size="large" />}>
                <Switch>
                    {
                        routes.map((route,index)=>{
                            return <AuthRoute key={index} {...route} />
                        })
                    }
                </Switch>
            </Suspense>
        </BrowserRouter>
    )
}

export default Router;
// 安装路由  npm i react-router-dom@5.3.0
// BrowserRouter  HashRouter